<?php

/**
 * Click form base class.
 *
 * @method Click getObject() Returns the current form's model object
 *
 * @package    25Mails
 * @subpackage form
 * @author     fabio.lorenzini@25solutions.com
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseClickForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'click_id'     => new sfWidgetFormInputHidden(),
      'link_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Link'), 'add_empty' => false)),
      'campaign_id'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Campaign'), 'add_empty' => false)),
      'recipient_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Recipient'), 'add_empty' => false)),
      'created_at'   => new sfWidgetFormDateTime(),
      'updated_at'   => new sfWidgetFormDateTime(),
      'deleted_at'   => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'click_id'     => new sfValidatorChoice(array('choices' => array($this->getObject()->get('click_id')), 'empty_value' => $this->getObject()->get('click_id'), 'required' => false)),
      'link_id'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Link'))),
      'campaign_id'  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Campaign'))),
      'recipient_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Recipient'))),
      'created_at'   => new sfValidatorDateTime(),
      'updated_at'   => new sfValidatorDateTime(),
      'deleted_at'   => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('click[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Click';
  }

}
